//
//  BK_Confirm_Order_ChooseExpress_Cell.m
//  bestkeep
//
//  Created by TOPTEAM on 2017/2/21.
//  Copyright © 2017年 utouu. All rights reserved.
//

#import "BK_Confirm_Order_ChooseExpress_Cell.h"
#import "BK_OD_Color.h"
#import "BK_OD_Tool.h"
@implementation BK_Confirm_Order_ChooseExpress_Cell
{
    UILabel *_courierName;
    UIImageView *_selectState;
    UIImageView *_line;
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self initialize];
    }
    return self;
}

- (void)initialize{
    
    self.backgroundColor = kOrderLightGrey;
    
    _courierName = [[UILabel alloc] init];
    _courierName.textColor = kOrderBlack1;
    _courierName.backgroundColor = [UIColor clearColor];
    _courierName.font = UIFontCustom(13);
    [self.contentView addSubview:_courierName];
    
    _selectState = [[UIImageView alloc] init];
    [self.contentView addSubview:_selectState];
    
    _line = [[UIImageView alloc] init];
    _line.backgroundColor = kOrderLightGrey2;
    [self.contentView addSubview:_line];
    
    [self makeConstraints];
}

- (void)makeConstraints{
    
    [_courierName mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.contentView).offset(ApplicationBackGauge);
        make.centerY.equalTo(self.contentView);
    }]; 
    
    [_selectState mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.contentView).offset(-ApplicationBackGauge);
        make.centerY.equalTo(self.contentView);
        make.width.mas_equalTo(14);
        make.height.mas_equalTo(14);
    }];
    
    [_line mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.right.mas_equalTo(self.contentView);
        make.height.mas_equalTo(1);
    }];
}

- (void)fillData:(id)data{
    BK_orders_dic_expressCompanyInfo_Model *courier = data;
    if (courier) {
        _courierName.text = courier.expressCompanyName;
        _selectState.image = [UIImage imageNamed:@"ordersplit_unselect_image"];
    }
}

+ (CGFloat)computeHeight:(id)data{
    return 36;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated{
    if (selected) {
        _selectState.image = [UIImage imageNamed:@"ordersplit_select_image"];
    }else{
        _selectState.image = [UIImage imageNamed:@"ordersplit_unselect_image"];
    }
}
@end
